package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.SeckillTimeBean;
import com.lwj.liwanjia.impl.SeckillTimeView;
import com.lwj.liwanjia.model.SeckillTimeModel;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/9/28.
 */

public class SeckillTimePresenter {
    private SeckillTimeView seckillTimeView;
    private SeckillTimeModel seckillTimeModel;

    public SeckillTimePresenter(SeckillTimeView seckillTimeView) {
        this.seckillTimeView = seckillTimeView;
        seckillTimeModel = new SeckillTimeModel();
    }

    public void getSeckillTime() {
        if (seckillTimeView != null)
            seckillTimeModel.getSeckillTime( new Subscriber<SeckillTimeBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    seckillTimeView.showError((Exception) e);
                }

                @Override
                public void onNext(SeckillTimeBean seckillTimeBean) {
                    seckillTimeView.getSeckillTime(seckillTimeBean);
                }
            });
    }
}
